Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shorten mapreduce by using Ops.reduce #858

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

tharittk
Copy link
Contributor

@tharittk tharittk commented Mar 8, 2025

From PR #840, the mapreduce() can be changed to call the Ops.reduce().
I found that I have to change the function signature by taking the @nonspecialize(f) out and substitute with (somewhat ugly?) f::F to force the Julia's compiler to recompile this function every time the new anonymous function for map is introduced to the function call i.e., what is in the test cases. Otherwise, there will be the world age issue.

I'm not so sure where to put the test in, so put it in ops.jl

@tharittk tharittk changed the title Shorten mapreduce Shorten mapreduce by using Ops.reduce Mar 8, 2025
@tharittk tharittk marked this pull request as draft March 8, 2025 13:41
@tharittk
Copy link
Contributor Author

tharittk commented Mar 8, 2025

Looks like CI fails badly when integrating to mapreduce. I have to work more on it.

Comment on lines -552 to -561
if dims != (:)
red = Ops.reshape(TracedRArray(red), toonedims...)
else
if length(outdims) == 0
red = TracedRNumber{redT}((), red)
else
red = TracedRArray{redT,length(outdims)}((), red, (outdims...,))
end
end
return red
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these checks need to be preserved to ensure that the final result matches julia semantics

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants